import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/pages/login'
import Home from '@/pages/home'
import System from '@/pages/system'
import File from '@/pages/system/file'
import Voice from '@/pages/system/voice'
import Set from '@/pages/system/set'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      }
    },
    {
      path: '/system',
      name: 'System',
      component: System,
      meta: {
        requireAuth: true
      },
      children: [
        {
          path: 'file',
          name: 'File',
          component: File,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'set',
          name: 'Set',
          component: Set,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'voice',
          name: 'Voice',
          component: Voice,
          meta: {
            requireAuth: true
          }
        }
      ]
    }
  ]
})
